home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 038a / ezwindo1.zip / PDDEMO.BAS < prev    next >
BASIC Source File  |  1990-11-19  |  10KB  |  246 lines

  1. '=========================================================================
  2.  
  3. '                   PULLDOWN demonstration program
  4. '                         Using EZWINDOWS library.
  5.  
  6. '                   Written by
  7. '                         John C. Strong
  8. '                         3155 S.W. 178th Aveneu
  9. '                         Aloha, OR 97006
  10.  
  11. '=========================================================================
  12.  
  13. '    Here's how to run this demo in the QB 4.x environment:
  14.  
  15. '         Make sure the EZPD.QLB file is in the current path,
  16. '         and start QuickBasic using the syntax
  17.  
  18. '                             QB /L EZPD
  19.  
  20. '         which loads the quick library EZPD.QLB along with QB.
  21. '         Then load DEMO.BAS from within QB and there you go!
  22.  
  23. '    Here's how to compile this demo into an executable file:
  24.  
  25. '         To compile this program (or any other program you may
  26. '         write with EZWINDOW), return to the DOS command line
  27. '         and follow this sequence of commands:
  28.  
  29. '              BC ProgramName,,nul
  30. '              link /e ProgramName,,,EZPD.LIB
  31.  
  32. '         Note the difference between EZPD.LIB and EZPD.QLB!
  33. '         Quick libraries are for use only inside the QB environment.
  34.  
  35. '=============================================================================
  36. '                         P R O G R A M    C O D E
  37. '=============================================================================
  38.  
  39.      DEFINT A-Z
  40.      REM $DYNAMIC
  41.      DIM HiPos1(10), HiPos2(10, 20), MaxSize(10), maxitems(10), item$(10, 15), valid(10, 15), toggle(10, 15)
  42.                                                   
  43.      col = 1                                      'assume color monitor
  44.      IF INSTR(COMMAND$, "BW") THEN col = 0        'user wants black/white
  45.      ms = 1                                       'assume mouse
  46.      IF INSTR(COMMAND$, "IM") THEN ms = 0         'user doesn't want mouse
  47.      COLOR 7, col * 5
  48.      CLS
  49.      
  50.      LOCATE 5, 5: PRINT "This is the PULLDOWN menu system!"
  51.      LOCATE 7, 5: PRINT "Here are some of its exciting features:"
  52.      LOCATE 9, 10
  53.      PRINT " Easily integrated into any existing QB 4.x program."
  54.      PRINT TAB(10); " Full mouse support."
  55.      PRINT TAB(10); " Full color control."
  56.      PRINT TAB(10); " Selections can by "; CHR$(34); "grayed"; CHR$(34); " out."
  57.      PRINT TAB(10); " Selections can be toggled inclusivley and exclusively."
  58.      PRINT TAB(10); " Mouse, cursor keys, or 'hot' keys can be used to"
  59.      PRINT TAB(12); "make a selection."
  60.      PRINT TAB(10); " 'Hot' key can be located anywhere in selection text."
  61.      PRINT TAB(10); " Menus pop up instantly, even on an XT!"
  62.      PRINT TAB(10); " Windows have a transparent shadow."
  63.      PRINT TAB(10); " Item will optionally blink upon selection."
  64.      PRINT TAB(10); " Dividing lines are inserted automatically."
  65.  
  66.      LOCATE 22, 5: PRINT "Select Exit from File menu when you're ready to quit..."
  67.      LOCATE 24, 5: PRINT "You selected:   ";
  68.  
  69.      FOR i = 1 TO 10          'HiPos1() holds the location in each menu
  70.           HiPos1(i) = 1       'name for the 'hot' key - in this case it
  71.      NEXT i                   'is the first letter in each name.
  72.     
  73.      'Load in menu data from data statements at the end of this program
  74.          
  75.      RESTORE PullDownMenuData
  76.     
  77.      FOR menu = 1 TO 8
  78.           READ maxitems(menu)               'Number of selections in each menu
  79.           READ MaxSize(menu)                'Max length of items in each menu
  80.           FOR slct = 1 TO maxitems(menu)
  81.                READ item$(menu, slct)       'Text displayed for selection
  82.                READ HiPos2(menu, slct)      'Hot key for each selection in menu
  83.                READ valid(menu, slct)       'Determines if grayed out or not
  84.                READ toggle(menu, slct)      'Determines if selection can be
  85.           NEXT slct
  86.      NEXT menu
  87.      
  88.      menuline$ = "   File  Edit  View  Search  Run  Debug  Calls  Options                         "
  89.     
  90.      menurow = 1                             'Screen row of menu line
  91.      menucol = 1                             'Beginning column position
  92.      MenuFG = 0                              'Menu foreground color
  93.      MenuBG = 7                              'Menu background color
  94.      HILITE = 15                             'Hot key hilite color
  95.      HiBarFG = 7                             'Hilite bar foreground color
  96.      HiBarBG = 0                             'Hilite bar background color
  97.      NonValidFG = 8                          'Foreground color for grayed-out
  98.                                              'selections
  99.      clearafter = 1                          'erase menu after selection
  100.      seed = 1                                'menu to start with
  101.      SoundOn = 1                             'turn sound on
  102.      blink = 1                               'turn BLINK option on
  103.     
  104.      CALL mouse(0, 0, 0, 0, 1)               'initialize mouse
  105.      CALL mouse(1, 0, 0, 0, 1)               'show mouse cursor
  106.      CALL mouse(10, 0, &H7000, 3844, ms)     'set mouse cursor
  107.  
  108.      DO
  109.           CALL PULLDOWN(menuline$, menurow, menucol, MenuFG, MenuBG, HILITE, HiBarFG, HiBarBG, NonValidFG, HiPos1(), HiPos2(), MaxSize(), maxitems(), item$(), valid(), toggle(), ms, clearafter, seed, SoundOn, blink, menuslct, itemslct)
  110.           LOCATE 24, 5
  111.           PRINT "You selected:   "; item$(menuslct, itemslct); "                      ";
  112.  
  113.           IF menuslct <> 0 AND LEFT$(item$(menuslct, itemslct), 1) <> "~" THEN
  114.                LOCATE 24, 20
  115.                PRINT item$(menuslct, itemslct);
  116.           END IF
  117.           IF toggle(menuslct, itemslct) <> 0 THEN
  118.                LOCATE 24, 40
  119.                IF toggle(menuslct, itemslct) > 0 THEN
  120.                     PRINT "ON   ";
  121.                ELSE
  122.                     PRINT "OFF  ";
  123.                END IF
  124.           END IF
  125.           seed = menuslct
  126.           IF seed = 0 THEN seed = 1
  127.  
  128.      LOOP UNTIL menuslct = 1 AND itemslct = 15
  129.     
  130.      REDIM HiPos1(0), HiPos2(0, 0), MaxSize(0), maxitems(0), item$(0, 0), valid(0, 0), toggle(0, 0)
  131.     
  132.      CALL mouse(2, 0, 0, 0, 1)               'turn off mouse cursor
  133.      COLOR 7, 0
  134.      CLS
  135.      END
  136.  
  137. '---------------------------- End of Program Code ----------------------------
  138.  
  139. '=============================================================================
  140. '                              M e n u   D a t a
  141. '=============================================================================
  142.  
  143.  
  144. PullDownMenuData:
  145.  
  146.      'File menu
  147.  
  148.      DATA 15,17
  149.      DATA " New Program     ",2,1,0
  150.      DATA " Open Program... ",2,1,0
  151.      DATA " Merge...        ",2,1,0
  152.      DATA " Save...         ",2,1,0
  153.      DATA " Save As         ",7,1,0
  154.      DATA " Save All        ",4,1,0
  155.     
  156.      'Here's an example of inserting a dividing line
  157.      DATA "~17",0,1,0          
  158.     
  159.      DATA " Create File...  ",2,1,0
  160.      DATA " Load File...    ",2,1,0
  161.      DATA " Unload File...  ",2,1,0
  162.      DATA "~17",0,1,0
  163.      DATA " Print...        ",2,1,0
  164.      DATA " DOS Shell       ",2,1,0
  165.      DATA "~17",0,1,0
  166.      DATA " Exit            ",3,1,0
  167.  
  168.      'Edit menu
  169.     
  170.      DATA 8,22
  171.      DATA " Undo   Alt+Backspace ",2,1,0
  172.      DATA " Cut        Shift+Del ",4,0,0
  173.      DATA " Copy        Ctrl+Ins ",2,0,0
  174.      DATA " Paste      Shift+Ins ",2,1,0
  175.      DATA " Clear            Del ",4,1,0
  176.      DATA "~22",0,1,0
  177.      DATA " New SUB...           ",6,1,0
  178.      DATA " New FUNCTION...      ",6,1,0
  179.  
  180.      'View menu
  181.     
  182.      DATA 9,24
  183.      DATA " SUBs...             F2 ",2,1,0
  184.      DATA " Next SUB      Shift+F2 ",3,1,0
  185.      DATA " Split                  ",3,1,0
  186.      DATA "~24",0,1,0
  187.      DATA " Next Statement         ",2,1,0
  188.      DATA " Output Screen       F4 ",3,1,0
  189.      DATA "~24",0,1,0
  190.      DATA " Included File          ",2,0,0
  191.      DATA " Included Lines         ",11,1,0
  192.  
  193.      'Search menu
  194.     
  195.      DATA 5,26
  196.      DATA " Find...                  ",2,1,0
  197.      DATA " Selected Text     Ctrl+\ ",2,1,0
  198.      DATA " Repeat Last Find      F3 ",2,1,0
  199.      DATA " Change...                ",2,1,0
  200.      DATA " Label...                 ",2,1,0
  201.  
  202.      'Run menu
  203.  
  204.      DATA  9,21
  205.      DATA " Start      Shift+F5 ",2,1,0
  206.      DATA " Restart             ",2,1,0
  207.      DATA " Continue         F5 ",4,1,0
  208.      DATA " Modify COMMAND$...  ",9,1,0
  209.      DATA "~21",0,1,0
  210.      DATA " Make EXE File...    ",8,1,0
  211.      DATA " Make Library...     ",7,1,0
  212.      DATA "~21",0,1,0
  213.      DATA " Set Main Module...  ",6,1,0
  214.  
  215.      'Debug menu
  216.     
  217.      DATA 13,29
  218.      DATA " Add Watch...                ",2,1,0
  219.      DATA " Instant Watch...   Shift+F9 ",2,1,0
  220.      DATA " Watchpoint...               ",2,1,0
  221.      DATA " Delete Watch...             ",2,0,0
  222.      DATA " Delete All Watch            ",4,0,0
  223.      DATA "~29",0,1,0
  224.      DATA " Trace On                    ",2,1,0
  225.      DATA " History On                  ",2,1,0
  226.      DATA "~29",0,1,0
  227.      DATA " Toggle Breakpoint        F9 ",9,1,0
  228.      DATA " Clear All Breakpoints       ",2,1,0
  229.      DATA " Break On Errors             ",11,1,0
  230.      DATA " Set Next Statement          ",2,0,0
  231.  
  232.      'Calls menu
  233.     
  234.      DATA 1,17
  235.      DATA " PDDEMO.BAS      ",2,1,0
  236.  
  237.      'Options menu
  238.     
  239.      DATA 5,17
  240.      DATA " Display...      ",2,1,0
  241.      DATA " Set Paths...    ",6,1,0
  242.      DATA " Right Mouse...  ",8,1,0
  243.      DATA " Syntax Checking ",2,1,1
  244.      DATA " Full Menus      ",2,1,1
  245.  
  246.